package com.greensam.pixelengine.pojo.entity;

import com.greensam.pixelengine.pojo.base.BaseEntity;
import com.greensam.pixelengine.pojo.emuns.ReviewStatusEnum;
import com.greensam.pixelengine.pojo.emuns.StatusEnum;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;

import java.time.LocalDateTime;

/**
 * @author Macro_Ray
 * @since 2025/7/1 16:24
 */
@Getter
@Setter
@Entity
@Table(name = "picture_info", indexes = {
        @Index(name = "idx_picture_name", columnList = "name"),
        @Index(name = "idx_picture_category", columnList = "category"),
        @Index(name = "idx_picture_tags", columnList = "tags"),
        @Index(name = "idx_create_id", columnList = "create_by"),
        @Index(name = "idx_review_status", columnList = "review_status"),
        @Index(name = "idx_space_id", columnList = "space_id")
})
@Comment("图片信息表")
public class PicturePo extends BaseEntity {

    @Column(nullable = false, length = 512)
    @Comment("图片地址")
    private String url;

    @Column(length = 512)
    @Comment("缩略图url")
    private String thumbnailUrl;

    @Column(nullable = false, length = 128)
    @Comment("图片名称")
    private String name;

    @Lob
    @Column(length = 1024)
    @Comment("图片描述")
    private String description;

    @Column(length = 128)
    @Comment("图片分类")
    private String category;

    @Column(length = 512)
    @Comment("图片标签（JSON数组）")
    private String tags;

    @Comment("图片大小")
    private Long picSize;

    @Comment("图片宽度")
    private Integer picWidth;

    @Comment("图片高度")
    private Integer picHeight;

    @Comment("图片宽高比例")
    private Double picScale;

    @Column(length = 32)
    @Comment("图片格式")
    private String picFormat;

    @Column(length = 128)
    @Comment("图片创建者")
    private String createName;

    @Comment("状态")
    @Enumerated(value = EnumType.STRING)
    private StatusEnum status;

    @Comment("审核状态")
    @Enumerated(value = EnumType.ORDINAL)
    private ReviewStatusEnum reviewStatus;

    @Comment("审核人")
    private Long reviewBy;

    @Comment("审核时间")
    private LocalDateTime reviewTime;

    @Column(length = 512)
    @Comment("审核信息")
    private String reviewMessage;

    @Column(length = 20)
    @ColumnDefault("null")
    @Comment("图片空间ID（公共空间为空）")
    private Long spaceId;

    @Column(length = 16)
    @ColumnDefault("null")
    @Comment("图片主色调")
    private String picColor;

}
